import { QXEvent } from 'qx-util';
import {
	IParam,
	AppMenuActionType,
	IAppMenuAbility,
	IAppMenuControllerParams,
	IAppMenuStore,
	AppMenuController,
	ICtrlEvent,
	IAppMenuController,
	IAppMenuModel,
} from '@/core';
import {
	useAppMenuAction,
	useAppMenuBasic,
	useAppMenuControllerParams,
	useAppMenuProps,
} from '@/hooks/widget/use-app-menu';
import { model } from './usr-0210019609-menu-menu-model';
// 基于template/src/widgets/{{appEntities}}/{{ctrls@APPMENU}}-menu/{{spinalCase ctrl.codeName}}-menu-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useAppMenuProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useAppMenuBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...useAppMenuAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<AppMenuActionType, IAppMenuAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<AppMenuActionType, IAppMenuAbility>>,
	otherParams: IParam = {}
): IAppMenuController<IAppMenuStore, IAppMenuAbility> {
	const params: IAppMenuControllerParams<AppMenuActionType, IAppMenuAbility> =
		useAppMenuControllerParams<IAppMenuStore, IAppMenuModel>(
			model,
			props,
			evt,
			otherParams
		);
	return new AppMenuController(params);
}
